<?php defined('SYSPATH') OR die('No direct access allowed.');
class Users_Controller extends Base_Controller {
 
	// Set the name of the template to use
	public $template = 'templates/base';

	public function index()
	{		
		// Create view
		$view=new View('users_content');

		// Create model
		$user = new User_Model();
		// get_user_name is a method defined in User_Model
		$id = 1;
		$userdata = $user->get_users();  
		$view->userdata = $userdata;

		$this->template->content = $view;
		$this->template->title = 'Users';
	}

	public function listusers() {
		$user = new User_Model();
		$userdata = $user->get_user(1); 
		
		if (request::is_ajax()) {
			echo json_encode($userdata);
		}
	}
}